package base.day06;

import java.util.Scanner;

public class Study2 {
    public static void main(String[] args) {
        //调用方法，求1-n之和，用return返回
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入：");
        int n = sc.nextInt();
        System.out.println(sumNumber(n));
    }

    public static int sumNumber(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        return sum;
    }
}
